package cn.pid21.client.request;

import cn.pid21.client.model.PidService;
import cn.pid21.client.util.RequestUtil;
import lombok.Getter;
import okhttp3.Request;

/**
 * PidQueryRequest
 *
 * @author 郭志斌
 * @version 1.0.0
 * @date 2019/8/16 15:28
 */
@Getter
public class PidQueryRequest implements PidRequest{

    /**
     * 查询文本
     */
    private String text;

    private PidQueryRequest(){}

    public static PidQueryRequest builder(){
        return new PidQueryRequest();
    }

    public PidQueryRequest text(String text){
        this.text = text;
        return this;
    }

    @Override
    public Request build(String clientId,String secret) {
        return RequestUtil.get(RequestUtil.headers(PidRequestHeader.builder().clientId(clientId).secret(secret)),
                service().getName(),"identifier",this.text);
    }

    @Override
    public PidService service() {
        return PidService.QUERY_SERVICE;
    }
}
